.class Lcom/xingbook/ting/fragment/e;
.super Landroid/os/Handler;


# instance fields
.field final synthetic a:Lcom/xingbook/ting/fragment/TingPlayBottomFragment;

.field private b:Z

.field private c:Ljava/lang/ref/WeakReference;


# direct methods
.method public constructor <init>(Lcom/xingbook/ting/fragment/TingPlayBottomFragment;Lcom/xingbook/ting/fragment/TingPlayBottomFragment;)V
    .locals 1

    iput-object p1, p0, Lcom/xingbook/ting/fragment/e;->a:Lcom/xingbook/ting/fragment/TingPlayBottomFragment;

    invoke-direct {p0}, Landroid/os/Handler;-><init>()V

    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/xingbook/ting/fragment/e;->b:Z

    new-instance v0, Ljava/lang/ref/WeakReference;

    invoke-direct {v0, p2}, Ljava/lang/ref/WeakReference;-><init>(Ljava/lang/Object;)V

    iput-object v0, p0, Lcom/xingbook/ting/fragment/e;->c:Ljava/lang/ref/WeakReference;

    return-void
.end method


# virtual methods
.method public handleMessage(Landroid/os/Message;)V
    .locals 10

    const/4 v9, 0x2

    const/4 v4, 0x0

    const/4 v8, 0x1

    invoke-super {p0, p1}, Landroid/os/Handler;->handleMessage(Landroid/os/Message;)V

    iget-object v0, p0, Lcom/xingbook/ting/fragment/e;->c:Ljava/lang/ref/WeakReference;

    invoke-virtual {v0}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/xingbook/ting/fragment/TingPlayBottomFragment;

    if-nez v0, :cond_1

    :cond_0
    :goto_0
    return-void

    :cond_1
    invoke-virtual {v0}, Lcom/xingbook/ting/fragment/TingPlayBottomFragment;->getActivity()Landroid/support/v4/app/FragmentActivity;

    move-result-object v1

    if-eqz v1, :cond_0

    iget v1, p1, Landroid/os/Message;->what:I

    packed-switch v1, :pswitch_data_0

    goto :goto_0

    :pswitch_0
    :try_start_0
    sget-object v1, Lcom/xingbook/ting/play/MusicService;->s:Lcom/xingbook/ting/play/MusicService;

    if-eqz v1, :cond_2

    sget-object v1, Lcom/xingbook/ting/play/MusicService;->s:Lcom/xingbook/ting/play/MusicService;

    invoke-virtual {v1}, Lcom/xingbook/ting/play/MusicService;->n()Landroid/media/MediaPlayer;

    move-result-object v1

    if-eqz v1, :cond_2

    invoke-virtual {v1}, Landroid/media/MediaPlayer;->isPlaying()Z

    move-result v2

    if-eqz v2, :cond_2

    invoke-virtual {v1}, Landroid/media/MediaPlayer;->getDuration()I

    move-result v1

    invoke-static {v0}, Lcom/xingbook/ting/fragment/TingPlayBottomFragment;->a(Lcom/xingbook/ting/fragment/TingPlayBottomFragment;)Landroid/widget/TextView;

    move-result-object v2

    int-to-long v3, v1

    const/4 v5, 0x0

    const/4 v6, 0x1

    const/4 v7, 0x1

    invoke-static {v3, v4, v5, v6, v7}, Lcom/xingbook/c/i;->a(JZZZ)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    invoke-static {v0}, Lcom/xingbook/ting/fragment/TingPlayBottomFragment;->b(Lcom/xingbook/ting/fragment/TingPlayBottomFragment;)Landroid/widget/SeekBar;

    move-result-object v0

    invoke-virtual {v0, v1}, Landroid/widget/SeekBar;->setMax(I)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :cond_2
    :goto_1
    iput-boolean v8, p0, Lcom/xingbook/ting/fragment/e;->b:Z

    invoke-virtual {p0, v9}, Lcom/xingbook/ting/fragment/e;->sendEmptyMessage(I)Z

    goto :goto_0

    :catch_0
    move-exception v0

    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_1

    :pswitch_1
    iput-boolean v4, p0, Lcom/xingbook/ting/fragment/e;->b:Z

    invoke-virtual {p0, v9}, Lcom/xingbook/ting/fragment/e;->removeMessages(I)V

    goto :goto_0

    :pswitch_2
    :try_start_1
    sget-object v1, Lcom/xingbook/ting/play/MusicService;->s:Lcom/xingbook/ting/play/MusicService;

    if-eqz v1, :cond_3

    sget-object v1, Lcom/xingbook/ting/play/MusicService;->s:Lcom/xingbook/ting/play/MusicService;

    invoke-virtual {v1}, Lcom/xingbook/ting/play/MusicService;->n()Landroid/media/MediaPlayer;

    move-result-object v1

    if-eqz v1, :cond_3

    invoke-virtual {v1}, Landroid/media/MediaPlayer;->isPlaying()Z

    move-result v2

    if-eqz v2, :cond_3

    invoke-virtual {v1}, Landroid/media/MediaPlayer;->getCurrentPosition()I

    move-result v1

    invoke-static {v0}, Lcom/xingbook/ting/fragment/TingPlayBottomFragment;->c(Lcom/xingbook/ting/fragment/TingPlayBottomFragment;)Landroid/widget/TextView;

    move-result-object v2

    int-to-long v3, v1

    const/4 v5, 0x0

    const/4 v6, 0x1

    const/4 v7, 0x1

    invoke-static {v3, v4, v5, v6, v7}, Lcom/xingbook/c/i;->a(JZZZ)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    invoke-static {v0}, Lcom/xingbook/ting/fragment/TingPlayBottomFragment;->b(Lcom/xingbook/ting/fragment/TingPlayBottomFragment;)Landroid/widget/SeekBar;

    move-result-object v0

    invoke-virtual {v0, v1}, Landroid/widget/SeekBar;->setProgress(I)V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1

    :cond_3
    :goto_2
    iget-boolean v0, p0, Lcom/xingbook/ting/fragment/e;->b:Z

    if-eqz v0, :cond_0

    const-wide/16 v0, 0x3e8

    invoke-virtual {p0, v9, v0, v1}, Lcom/xingbook/ting/fragment/e;->sendEmptyMessageDelayed(IJ)Z

    goto :goto_0

    :pswitch_3
    iput-boolean v4, p0, Lcom/xingbook/ting/fragment/e;->b:Z

    invoke-virtual {p0, v9}, Lcom/xingbook/ting/fragment/e;->removeMessages(I)V

    invoke-static {v0}, Lcom/xingbook/ting/fragment/TingPlayBottomFragment;->c(Lcom/xingbook/ting/fragment/TingPlayBottomFragment;)Landroid/widget/TextView;

    move-result-object v1

    const-wide/16 v2, 0x0

    invoke-static {v2, v3, v4, v8, v8}, Lcom/xingbook/c/i;->a(JZZZ)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    invoke-static {v0}, Lcom/xingbook/ting/fragment/TingPlayBottomFragment;->b(Lcom/xingbook/ting/fragment/TingPlayBottomFragment;)Landroid/widget/SeekBar;

    move-result-object v0

    invoke-virtual {v0, v4}, Landroid/widget/SeekBar;->setProgress(I)V

    goto/16 :goto_0

    :catch_1
    move-exception v0

    goto :goto_2

    nop

    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_0
        :pswitch_1
        :pswitch_2
        :pswitch_3
    .end packed-switch
.end method
